// 引入网络请求axios文件
import axios from "axios";
// import http from "./http";
import { api } from './default'
// 定义常量记录地址信息
import { URL } from './env.config'
// GET测试
export const testget = (data: any) => {
    return axios.get(`${URL}${api.test}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取广告列表
export const advertListApi = (data?: any) => {
    return axios.get(`${URL}${api.advert.list}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取广告详情接口
export const advertDetailApi = (data?: any) => {
    return axios.get(`${URL}${api.advert.detail}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
/*
*
* 导航部分接口
*
*/
export const navModifyApi = (data?: any) => {
    return axios.get(`${URL}${api.navigate.modify}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const navDetailApi = (data?: any) => {
    return axios.get(`${URL}${api.navigate.detail}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const navRemoveApi = (data?: any) => {
    return axios.get(`${URL}${api.navigate.remove}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const navListApi = (data?: any) => {
    return axios.get(`${URL}${api.navigate.list}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}

// POST测试
export const testpost = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.test}`, data, option).then(response => response.data).catch(error => console.log(error))
}
/*
* 用户部分接口
*
*/
// 用户登录接口
export const loginApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.login}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 用户注册接口
export const registerApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.register}`, data, option).then(response => response.data).catch(error => console.log(error))
}

// 判断用户是否登录接口
export const loggedApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.logged}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 获取获取用户昵称接口
export const nickNameApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.nickName}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 删除用户
export const userRemoveApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.user.remove}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 获取用户列表
export const userListApi = (data?: any) => {
    return axios.get(`${URL}${api.user.list}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取分页
export const userItemsApi = (data?: any) => {
    return axios.get(`${URL}${api.user.items}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取用户总数接口
export const userAllApi = (data?: any) => {
    return axios.get(`${URL}${api.user.all}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
/*
* 轮播图部分接口
*
*/
// 添加广告接口
export const advertPublishApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.advert.publish}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 删除广告接口
export const advertRemoveApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.advert.remove}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 修改广告接口
export const advertModifyApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.advert.modify}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 搜索广告接口
export const advertSearchApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.advert.search}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 删除广告图片接口
export const advertDeleteApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.advert.delete}`, data, option).then(response => response.data).catch(error => console.log(error))
}


// 添加导航
export const navAddApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.navigate.add}`, data, option).then(response => response.data).catch(error => console.log(error))
}

/*
*
* 文章部分接口
*
*/
// 发布文章接口
export const articleAddApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.article.add}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 更新文章接口
export const articleUpdateApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.article.update}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 删除文章接口
export const articleRemoveApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.article.remove}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 获取文章列表接口
export const articleListApi = (data?: any) => {
    return axios.get(`${URL}${api.article.list}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取分页文章列表（分页）接口
export const articleItemsApi = (data?: any) => {
    return axios.get(`${URL}${api.article.items}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取文章详情接口
export const articleDetailApi = (data?: any) => {
    return axios.get(`${URL}${api.article.detail}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 搜索文章接口
export const articleSearchApi = (data?: any) => {
    return axios.get(`${URL}${api.article.search}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 统计文章接口
export const articleAllApi = (data?: any) => {
    return axios.get(`${URL}${api.article.all}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
/*
*
* 内容部分接口
*
*/
// 发布内容接口
export const contentAddApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.content.add}`, data, option).then(response => response.data).catch(error => console.log(error))
}
export const contentUpdateApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.content.update}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 删除内容接口
export const contentRemoveApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.content.remove}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 获取内容列表接口
export const contentListApi = (data?: any) => {
    return axios.get(`${URL}${api.content.list}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取分页内容列表（分页）接口
export const contentItemsApi = (data?: any) => {
    return axios.get(`${URL}${api.content.items}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取内容详情接口
export const contentDetailApi = (data?: any) => {
    return axios.get(`${URL}${api.content.detail}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 搜索内容接口
export const contentSearchApi = (data?: any) => {
    return axios.get(`${URL}${api.content.search}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 统计内容接口
export const contentAllApi = (data?: any) => {
    return axios.get(`${URL}${api.content.all}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}

/*
*
* 视频部分接口
*
*/
// 发布视频接口
export const videoAddVideoPicApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.video.add_video_pic}`, data, option).then(response => response.data).catch(error => console.log(error))
}
export const videoUpdateApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.video.update}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 删除视频接口
export const videoRemoveApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.video.remove}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 获取视频列表接口
export const videoListApi = (data?: any) => {
    return axios.get(`${URL}${api.video.list}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取分页视频列表（分页）接口
export const videoItemsApi = (data?: any) => {
    return axios.get(`${URL}${api.video.items}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取视频详情接口
export const videoDetailApi = (data?: any) => {
    return axios.get(`${URL}${api.video.detail}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 搜索视频接口
export const videoSearchApi = (data?: any) => {
    return axios.get(`${URL}${api.video.search}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 统计视频接口
export const videoAllApi = (data?: any) => {
    return axios.get(`${URL}${api.video.all}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}

// 合并视频切片接口
export const videoMergeApi = (data?: any) => {
    return axios.get(`${URL}${api.video.merge}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 上传视频切片接口
export const videoUploadApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.video.upload}`, data, option).then(response => response.data).catch(error => console.log(error))
}

// 删除视频封面
export const videoRomovePicApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.video.deleteImg}`, data, option).then(response => response.data).catch(error => console.log(error))
}


/*
*
* 签到部分接口
*
*/

// 统计今天签到接口
// console.log(api.signin2)
export const signinAllApi = (data?: any) => {
    return axios.get(`${URL}${api.signin2.all}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 设置签到
export const signinAddApi = (data?: any) => {
    return axios.get(`${URL}${api.signin2.add}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取分页数据
export const signinItemsApi = (data?: any) => {
    return axios.get(`${URL}${api.signin2.items}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 移除签到
export const signinRemoveApi = (data?: any) => {
    return axios.get(`${URL}${api.signin2.remove}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 统计个人签到
export const signinTotalApi = (data?: any) => {
    return axios.get(`${URL}${api.signin2.total}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const signinListApi = (data?: any) => {
    return axios.get(`${URL}${api.signin2.list}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
/*
*
* 评论部分接口
*
*/

// 评论列表接口
// console.log(api.signin2)
export const commentArticleItemsApi = (data?: any) => {
    return axios.get(`${URL}${api.comment.article.items}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const commentContentItemsApi = (data?: any) => {
    return axios.get(`${URL}${api.comment.content.items}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// export const commentArticleRemoveApi = (data?: any) => {
//     return axios.get(`${URL}${api.comment.article.remove}`, { params: data }).then(response => response.data).catch(error => console.log(error))
// }
export const commentArticleRemoveApi = (data?: any) => {
    return axios.get(`${URL}${api.comment.article.remove_admin}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}

export const commentContentRemoveApi = (data?: any) => {
    return axios.get(`${URL}${api.comment.content.remove}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const commentArticleAllApi = (data?: any) => {
    return axios.get(`${URL}${api.comment.article.all}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const commentContentAllApi = (data?: any) => {
    return axios.get(`${URL}${api.comment.content.all}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}

/*
*
* 回复部分接口
*
*/
export const replyArticleItemsApi = (data?: any) => {
    return axios.get(`${URL}${api.reply.article.items}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const replyContentItemsApi = (data?: any) => {
    return axios.get(`${URL}${api.reply.content.items}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const replyArticleRemoveApi = (data?: any) => {
    return axios.get(`${URL}${api.reply.article.remove}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const replyContentRemoveApi = (data?: any) => {
    return axios.get(`${URL}${api.reply.content.remove}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const replyArticleAllApi = (data?: any) => {
    return axios.get(`${URL}${api.reply.article.all}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
export const replyContentAllApi = (data?: any) => {
    return axios.get(`${URL}${api.reply.content.all}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}


/*
*
* 管理员登录入口
*
*
*/
// 管理员登录接口
export const loginAdminApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.admin_login}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 管理员注册接口
export const registerAdminApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.admin_register}`, data, option).then(response => response.data).catch(error => console.log(error))
}
// 获取管理员分页
export const adminItemsApi = (data?: any) => {
    return axios.get(`${URL}${api.admin.items}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 获取用户总数接口
export const adminAllApi = (data?: any) => {
    return axios.get(`${URL}${api.admin.all}`, { params: data }).then(response => response.data).catch(error => console.log(error))
}
// 删除用户
export const adminRemoveApi = (data: any, option: any = { headers: 'application/x-www-form-urlencoded' }) => {
    return axios.post(`${URL}${api.admin.remove}`, data, option).then(response => response.data).catch(error => console.log(error))
}